﻿#region Header

/*
Remote views based on linq
By

Pascal Hauser 
Dipl. Ing. in Informatik, Hochschule für Technik Rapperswil, 2006
Master Thesis, Hochschule für Technik Rapperswil, 2008-2010

and

Raphael Gfeller
Dipl. Ing. in Informatik, Hochschule für Technik Rapperswil, 2006
Master Thesis, Hochschule für Technik Rapperswil, 2008-2010

*/

#endregion

#region Usings

using System;
using System.Collections.Generic;
using System.Reflection;
using Sebarf.Services.Interfaces;
using Utils;

#endregion

namespace Sebarf.Utils.Interfaces {
	/// <summary>
	/// Description of the class
	/// </summary>
	public class ObjectHierarchyFlattenerService : Service, IObjectHierarchyFlattenerService {
		#region Public Properties

		public HieararchyFlattener HieararchyFlattener { get; set; }

		public Dictionary<Type, List<FieldInfo>> FieldInfoLookup {
			get { return HieararchyFlattener.FieldInfoLookup; }
			set { HieararchyFlattener.FieldInfoLookup = value; }
		}

		#endregion

		#region Public Methods

		public ObjectHierarchyFlattenerService() {
			HieararchyFlattener = new HieararchyFlattener();
		}

		#endregion

		#region IObjectHierarchyFlattenerService Members

		public List<ExtendMetadata> ExtendedFlatten(object o) {
			return HieararchyFlattener.ExtendedFlatten(o);
		}

		public object[] Flatten(object o, delMetadataCollector collector, ref object output) {
			return HieararchyFlattener.Flatten(o, collector, ref output);
		}

		public List<object> Flatten(object o) {
			return HieararchyFlattener.Flatten(o);
		}

		public PropertyInfo[] GetAllProperties(Type t) {
			return HieararchyFlattener.GetAllProperties(t);
		}

		#endregion
	}
}